Stream processing with runtime adaptation

ABSTRACT

Embodiments of the disclosure include a system for providing stream processing with runtime adaptation, having a stream processing application that receives an incoming data stream and a runtime infrastructure configured to execute the stream processing application. The system also includes an orchestrator configured to communicate with the runtime infrastructure and the stream processing application, the orchestrator configured to perform a method. The method includes registering one or more events, wherein each of the events is associated with a stream processing application. The method also includes monitoring, by a processor, for an occurrence of the one or more events associated with the stream processing application, wherein each of the one or more events is associated with one or more runtime metrics. The method further includes receiving an event notification, wherein the event notification includes event identification and an event context and executing an adaptation of the stream processing application.

BACKGROUND

The present disclosure relates to stream processing, and morespecifically, to methods and systems of stream processing includingruntime adaptations.

Stream processing applications perform a sequence of transformations ondata streams and are composed as data flow graphs, where each vertex ofthe graph is an operator instance and each edge is a stream connection.In general, stream processing applications execute data transformationsupon the arrival of a stream of data items, referred to as a tuples, andsends the newly computed data item to an output stream. In order toachieve high-performance and scalability, the stream processingapplication can be executed in a distributed fashion over a set ofhosts.

Typically, streaming applications are deployed by submitting thecomposed data flow graph to a target stream processing infrastructure,which continuously runs the application until it is explicitlycancelled. In general, multiple applications can be submitted to theinfrastructure at different times. These applications can connect toeach other at runtime to form time-evolving solutions.

Streaming applications often need to be adapted to changes in runtimeconditions. For instance, when the application is overloaded due to atransient high input data rate, it may need to temporarily apply loadshedding policies to maintain a guaranteed quality of service, orresponse time. However, stream processing languages that are used fordeveloping stream processing applications do not provide constructs forruntime adaptation. This is because these languages are generallydeclarative. As a result, developers focus on expressing data processinglogic, but not adapting to changes in runtime conditions.

SUMMARY

According to an exemplary embodiment, a computer program product forproviding stream processing with runtime adaptation, the computerprogram product includes a tangible storage medium readable by aprocessing circuit and storing instructions for execution by theprocessing circuit for performing a method. The method includesregistering one or more events, wherein each of the events is associatedwith a stream processing application. The method also includesmonitoring, by a processor, for an occurrence of the one or more eventsassociated with the stream processing application, wherein each of theone or more events is associated with one or more runtime metrics. Themethod further includes receiving an event notification, wherein theevent notification includes event identification and an event contextand executing an adaptation of the stream processing application.

According to another exemplary embodiment, a system for providing streamprocessing with runtime adaptation, includes a stream processingapplication that receives an incoming data stream and a runtimeinfrastructure configured to execute the stream processing application.The system also includes an orchestrator configured to communicate withthe runtime infrastructure and the stream processing application, theorchestrator configured to perform a method. The method includesregistering one or more events, wherein each of the events is associatedwith a stream processing application. The method also includesmonitoring, by a processor, for an occurrence of the one or more eventsassociated with the stream processing application, wherein each of theone or more events is associated with one or more runtime metrics. Themethod further includes receiving an event notification, wherein theevent notification includes event identification and an event contextand executing an adaptation of the stream processing application.

Additional features and advantages are realized through the techniquesof the present disclosure. Other embodiments and aspects of thedisclosure are described in detail herein and are considered a part ofthe claimed invention. For a better understanding of the disclosure withthe advantages and the features, refer to the description and to thedrawings.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

The subject matter which is regarded as the invention is particularlypointed out and distinctly claimed in the claims at the conclusion ofthe specification. The forgoing and other features, and advantages ofthe disclosure are apparent from the following detailed descriptiontaken in conjunction with the accompanying drawings in which:

FIG. 1 is a block diagram illustrating one example of a processingsystem for practice of the teachings herein;

FIG. 2 is a block diagram illustrating a system for stream processingwith runtime adaptation in accordance with an exemplary embodiment;

FIG. 3 is a flow diagram that illustrates a method for configuring anorchestrator that provides runtime adaptation during stream processingin accordance with an exemplary embodiment;

FIG. 4 is a flow diagram that illustrates a method for stream processingwith runtime adaptation in accordance with an exemplary embodiment;

FIG. 5 is a code segment of orchestrator logic in accordance with anexemplary embodiment; and

FIG. 6 is a block diagram that illustrates a dependency graph for anorchestrator managing six different streaming applications in accordancewith an exemplary embodiment.

DETAILED DESCRIPTION

Referring to FIG. 1, there is shown an embodiment of a processing system100 for implementing the teachings herein. In this embodiment, thesystem 100 has one or more central processing units (processors) 101 a,101 b, 101 c, etc. (collectively or generically referred to asprocessor(s) 101). In one embodiment, each processor 101 may include areduced instruction set computer (RISC) microprocessor. Processors 101are coupled to system memory 114 and various other components via asystem bus 113. Read only memory (ROM) 102 is coupled to the system bus113 and may include a basic input/output system (BIOS), which controlscertain basic functions of system 100.

FIG. 1 further depicts an input/output (I/O) adapter 107 and a networkadapter 106 coupled to the system bus 113. I/O adapter 107 may be asmall computer system interface (SCSI) adapter that communicates with ahard disk 103 and/or tape storage drive 105 or any other similarcomponent. I/O adapter 107, a direct access storage device or hard disk103, and tape storage device 105 are collectively referred to herein asmass storage 104. A network adapter 106 interconnects bus 113 with anoutside network 116 enabling data processing system 100 to communicatewith other such systems and external storage devices. A screen (e.g., adisplay monitor) 115 is connected to system bus 113 by display adaptor112, which may include a graphics adapter to improve the performance ofgraphics intensive applications and a video controller. In oneembodiment, adapters 107, 106, and 112 may be connected to one or moreI/O busses that are connected to system bus 113 via an intermediate busbridge (not shown). Suitable I/O buses for connecting peripheral devicessuch as hard disk controllers, network adapters, and graphics adapterstypically include common protocols, such as the Peripheral ComponentsInterface (PCI). Additional input/output devices are shown as connectedto system bus 113 via user interface adapter 108 and display adapter112. A keyboard 109, mouse 110, and speaker 111 all interconnected tobus 113 via user interface adapter 108, which may include, for example,a Super I/O chip integrating multiple device adapters into a singleintegrated circuit.

Thus, as configured in FIG. 1, the system 100 includes processingcapability in the form of processors 101, storage capability includingsystem memory 114 and mass storage 104, input means such as keyboard 109and mouse 110, and output capability including speaker 111 and display115. In one embodiment, a portion of system memory 114 and mass storage104 collectively store an operating system such as the z/OS® operatingsystem from IBM Corporation to coordinate the functions of the variouscomponents shown in FIG. 1.

Examples of operating systems that may be supported by the system 100include Windows 95, Windows 98, Windows NT 4.0, Windows XP, Windows2000, Windows CE, Windows Vista, Macintosh, LINUX, and UNIX, z/OS or anyother suitable operating system. The system 100 also includes a networkinterface 116 for communicating over a network. The network can be alocal-area network (LAN), a metro-area network (MAN), or wide-areanetwork (WAN), such as the Internet or World Wide Web. Users of thesystem 100 can connect to the network through any suitable networkinterface 116 connection, such as standard telephone lines, digitalsubscriber line, LAN or WAN links (e.g., T1, T3), broadband connections(Frame Relay, ATM), and wireless connections (e.g., 802.11a, 802.11b,802.11g).

As disclosed herein, the system 100 includes machine readableinstructions stored on machine readable media (for example, the harddisk 103) for capture and interactive display of information shown onthe screen 115 of a user. As discussed herein, the instructions arereferred to as “software” 120. The software 120 may be produced usingsoftware development tools as are known in the art. Also discussedherein, the software 120 may also referred to as a “command line testingtool” 120, an “a testing interface” 120 or by other similar terms. Thesoftware 120 may include various tools and features for providing userinteraction capabilities as are known in the art. The software 120 caninclude a database management subsystem such as DB2®, which managesstructured data access requests and queries from end users andapplications.

In exemplary embodiments, a stream processing language can be used tocreate stream processing applications. One example of a streamprocessing language is IBM Streams Processing Language (SPL). SPL allowsthe composition of streaming applications by assembling operators andexpressing stream interconnections. In SPL, operators can implement anylogical function (e.g., filtering, aggregation, image processing) and bearbitrarily interconnected. To execute a streaming application, an SPLcompiler places operators into processing elements (PEs), which areruntime containers for one or more operators. During execution, each PEmaps to an operating system process, which can execute on any hostavailable in a runtime infrastructure. The compiler may partitionoperators into PEs based on performance measurements and followingpartition constraints informed by the application developer viaannotations. During runtime, PEs may be distributed over hosts accordingto host placement constraints informed by developers as well as theresource availability of hosts and load balancing requirements.

In exemplary embodiments, SPL may specify one or more runtime metricsfor the streaming application. In exemplary embodiments, the runtimemetrics are counters updated during execution of the streamingapplication and can be read externally by users to inspect runtimestatistics. The runtime metrics may include both built-in and custommetrics. In exemplary embodiments, built-in metrics are counters thatmaintain information that is common to all operators and PEs in thesystem. For example, the number of tuples processed per operator, thenumber of tuples sent by an operator, or the number of tuple bytesprocessed by a PE. In exemplary embodiments, custom metrics are countersthat maintain information that relates to a specific operator typeavailable in SPL. For example, a filter operator may maintain the numberof tuples it discards. In exemplary embodiments, custom metrics may becreated at any point, including during the execution of the streamingapplication.

Streaming applications may have distinct logical and physicalrepresentations because a single streaming application, which can berepresented by a stream processing graph, can be separated intodifferent operating system processes and run on a distributed set ofhosts. As a result, adaptation policies need to be able to understandand influence the physical representation of the stream processinggraph. Accordingly, in exemplary embodiments a mapping between thelogical and the physical representation is available to the developersvia the orchestrator.

Referring now to FIG. 2, a block diagram of a system 200 for streamprocessing with runtime adaption in accordance with an exemplaryembodiment is shown. As illustrated, the system 200 includes a runtimeinfrastructure 210, a stream processing application 220, and anorchestrator 230. In exemplary embodiments, the orchestrator 230 isconfigured to communicate with the runtime infrastructure 210 and thestream processing application 220. The stream processing application 220receives incoming data streams 202 and may produce outgoing data streams204. The orchestrator 230 allows developers of stream processingapplication 220 to register events of interest and specify handlers thatwill be executed upon the occurrence of these events. By running anorchestrator 230 together with the stream processing application 220,developers can effectively make the stream processing applications 220follow a specific management policy. In addition, the orchestrator 230provides a uniform way to implement event detection and actuationpolicies for stream processing applications 220.

In exemplary embodiments, the runtime infrastructure 210 includes aStreams Application Manager (SAM) 212, a Streams Resource Manager (SRM)214, and a Host Controller (HC) 216. The SAM 212 receives applicationsubmission and cancellation requests. Each application submitted to SAM212 is considered a new job in the stream processing system 200. Whenstarting a job, SAM 212 assigns all the PEs associated with thatapplication according to their placement constraints. SAM 212 can alsostop and restart PEs running in the system. In exemplary embodiments,the SRM 214 is responsible for maintaining information regarding whichhosts are available to the for application deployment. It also maintainsstatus information about which system components (e.g., SAM) and PEs areup and running. The SRM 214 is responsible for detecting and notifyingthe occurrence of process or host failures. In exemplary embodiments,SRM 214 also serves as a collector for all runtime metrics maintained bythe system, such as the built-in and custom metrics of all streamingapplications under execution. In exemplary embodiments, the HC 216resides in each host of the system that can run streaming applications.The HC 216 does local operations on behalf of the central components ofthe system, such as starting local processes for running PEs andmaintaining process status information. The HC 216 also collects metricsfrom PEs running locally and periodically sends them to SRM 214.

In exemplary embodiments, the orchestrator 230 includes orchestratorlogic 232 and an orchestrator service 234. The orchestrator logic 232includes the application-specific control code and can be used to startand control one or more streaming applications. The orchestrator service234 provides the orchestrator logic 232 a set of interfaces for eventhandling and an API to help the implementation of actuation routines.The orchestrator logic 232 registers runtime events of interest andspecifies handlers that will be executed upon the delivery of theseevents. The orchestrator service 234 is a runtime component that detectschanges and delivers relevant events to the orchestrator logic 232. Theorchestrator logic 232 can further use the orchestrator service 234 toinspect the meta-data associated with the running application componentsto carry on specific tasks.

In exemplary embodiments, the orchestrator logic 232 can invoke routinesfrom the orchestrator service 234 by using a reference received duringconstruction. In exemplary embodiments, the orchestrator logic 232 canonly receive events and act on streaming applications that were startedthrough the orchestrator service 234. If the orchestrator logic 232attempts to act on jobs that it did not start, the orchestrator service234 reports a runtime error. In exemplary embodiment, the components ofthe runtime infrastructure 210 (e.g., SAM 212 and SRM 214) are aware ofan orchestrator 230 as a manageable entity. For example, the SAM 212 maykeep track of all orchestrators 230 running in the system 200 and theirassociated streaming applications 220.

Referring now to FIG. 3 a flow diagram of a method for configuring anorchestrator that provides runtime adaptation during stream processingin accordance with an exemplary embodiment is shown. As shown at block300, the method begins with the submission of an orchestratordescription file to SAM. Next, as shown at block 302, the SAM theninitiates a process to execute the orchestrator service. In exemplaryembodiments, the orchestrator service is executed as a new process toensure memory isolation between user-written code and infrastructurecomponents. As illustrated at block 304, the orchestrator service loadsthe orchestrator logic shared library and invokes an orchestrator startevent callback. Next, as shown at block 306, the orchestrator logiccalls a function from the orchestrator service. As a result, theorchestrator service can issue and receive calls to/from infrastructurecomponents, such as SAM, SRM, and operators belonging to a managedstreaming application.

In exemplary embodiments, the orchestrator service may interact withexternal components to generate events to the orchestrator logic. Forexample, the orchestrator service can generate component failure eventsonce SAM pushes a failure notification. In exemplary embodiments, thegeneration of such an event does not add a performance penalty to thestreaming applications, since existing failure detection mechanismsalready available are being re-used. The handling of such an event bythe orchestrator, however, can increase the recovery time of thestreaming application, since the failure reaction is delayed by oneextra remote procedure call (from SAM to orchestrator service) plus thetime consumed by the user-specific failure handling routine. Inexemplary embodiments, the orchestrator service generates runtime metricevents by pulling such data from SRM at a specified rate. In addition,PEs may be configured to deliver updated runtime metrics to SRM at fixedrates independent of orchestrator calls. The orchestrator service canalso receive user-generated events via a command tool, which generates adirect call to the orchestrator service.

Referring now to FIG. 4 a flow diagram of a method for stream processingwith runtime adaptation in accordance with an exemplary embodiment isshown. As shown at block 400, the method includes specifying one or moreevents, wherein each of the events is associated with a streamprocessing application. Next, as shown at block 402, the method includesmonitoring one or more runtime metrics associated with the streamprocessing application. The method also includes receiving an eventnotification, as shown at block 404. In exemplary embodiments, the eventnotification includes event identification and an event context. Basedon receiving the event notification, the method includes executing anadaptation of the stream processing application, as shown at block 406.

In exemplary embodiments, the event notification may include the currentvalue of a streaming application runtime metric. The orchestrator logiccan use such value to evaluate if a runtime metric is exceeding athreshold value. For example, this evaluation may indicate that aprocessing element has exceeded a desired maximum workload. Accordingly,the adaptation of the stream processing application may includereassigning one or more of the processing elements to a different host.In exemplary embodiments, the adaptation of the stream processingapplication may include changing a sampling rate of the streamprocessing application.

In exemplary embodiments, a developer may use the orchestrator to createand implement a management policy for a streaming application. Themanagement policy may specify events of interest and how the applicationshould adapt upon the occurrence of these events. The management policycan be specified in the orchestrator logic by using APIs provided by theorchestrator service (e.g., actuation methods that are applicable to allstreaming applications). In exemplary embodiments, the orchestratorservice can deliver two different sets of events to the orchestratorlogic. The first set has events generated by the orchestrator serviceitself. For example, a start signal, job submission, job cancellation,and timer expiration. The second set of events requires the orchestratorservice to interact with external middleware runtime components. Theseinclude events related to runtime metrics, failure events, anduser-defined events.

To simplify the development of the orchestrator logic and reduce thenumber of notifications received during runtime, developers can specifyan event scope of interest. In exemplary embodiments, the only eventthat must be handled by the orchestrator logic is the startnotification. In exemplary embodiments, the orchestrator service eventscope may be composed of a disjunction of sub-scopes. The orchestratorservice delivers an event to the orchestrator logic when it matches atleast one of the registered sub-scopes. The orchestrator service maydeliver each event only once, even when the event matches more than onesub-scope. Creating a sub-scope to be registered with the orchestratorservice requires the definition of which type of events the applicationcontrol logic needs. Some examples of event types include, but are notlimited to, PE failures, operator metrics, PE metrics, and operator portmetrics.

In exemplary embodiments, sub-scopes can be further refined based on thedifferent attributes of an event. For example, one attribute of an eventmay be a type. A sub-scope can define a filter on these attributes, suchas asking for events that have a given type. Other available eventattributes include, but are not limited to, application relatedattributes (e.g., application name) and attributes of the sub-graph ofthe application that the event is contained within (e.g., type of theoperator that the event occurred on). This fine grained filtering isenabled by the stream graph representation maintained by theorchestrator service for all applications being managed. Filteringconditions defined on the same attribute are considered disjunctive(e.g., as asking for an event that is associated with application A orapplication B), while conditions defined on different attributes areconsidered conjunctive (e.g., as asking for an event that is associatedwith application A and contained within operator type filter). Theorchestrator logic can register multiple sub-scopes of the same type.

Referring now to FIG. 5 a code segment of orchestrator logic inaccordance with an exemplary embodiment is shown. As shown, theorchestrator logic receives events that match two different types ofsub-scopes. The first sub-scope is of type operator metric(OperatorMetricScope, line 04). It matches events related to a limitedset of composites with specific type (line 05), a further limited set ofoperators with specific type (line 06) and related to one specificmetric (lines 07-08). In exemplary embodiments, developers can specifysub-scopes by considering the application structure. For example, theinvocation to addCompositeTypeFilter (line 05) results in only operatorsresiding in a composite of type composite1 being considered for eventdelivery, where a composite is a reusable subgraph of a streamingapplications. The invocation to addOperatorTypeFilter (line 06) leads toan additional filtering condition, which mandates only events associatedwith operators of type Split and Merge to be delivered. Once theorchestrator service receives the ‘oms’ sub-scope registration (line13), the orchestrator logic can receive operator metric events for allmetrics named queueSize from operators of type Split or Merge that arecontained in any instance of a composite operator of type composite1.The second sub-scope matches PE failure events (PEFailureScope, line10). This sub-scope only has an application filter(addApplicationFilter, line 11), so failure events affecting PEs thatcontain any operator in the application are delivered to theorchestrator logic.

In exemplary embodiments, the orchestrator service delivers all eventsmatching at least one of the registered sub-scopes to the orchestratorlogic. In one embodiment, events are delivered to the orchestrator logicone at a time. If other events occur while an event handling routine isunder execution, these events are queued by the orchestrator service inthe order they were received. For each event, the orchestrator servicedelivers two items to the orchestrator logic. The first item deliveredis an event identification, which includes an identification of all ofthe sub-scopes that match the delivered event. In exemplary embodiments,developers may associate a key with a sub-scope when the sub-scope iscreated (lines 04 and 11 in FIG. 5). The second item delivered is anevent context, which contains runtime information relating to thestreaming application in which the event occurred. In exemplaryembodiments, the event context has the minimum information required tocharacterize each type of event. In exemplary embodiments, developerscan use the event context to further query the orchestrator service andinspect the logical and physical representation of the application. Theorchestrator logic can use this information to decide the appropriateadaptation, or management action, to execute.

In exemplary embodiments, the orchestrator service periodically queriesthe SRM infrastructure components for built-in and custom metric-relatedevents. The query frequency may have a default value, but this frequencycan be changed at any point of the execution. Since SRM's responsecontains all metrics associated with a set of jobs, many of them canmatch the current orchestrator service event scope at the same time. Foreach metric that matches the event scope, the orchestrator servicedelivers one event. To facilitate the identification of metric valuesthat are measured in the same round (i.e., pertaining to the same SRMquery response), the orchestrator service can add an epoch value to theevent context. The epoch value is incremented at each SRM query andserves as a logical clock for the orchestrator logic. In exemplaryembodiments, the epoch value can be used when the event handling routineneeds to evaluate if multiple metrics together meet a given condition.

In exemplary embodiments, the orchestrator service delivers PE failureevents to the orchestrator logic immediately after receiving anotification that such an event occurred from SAM. When SAM receives aPE crash notification (e.g., due to an uncaught exception), itidentifies which orchestrator service managing the crashed PE and theninforms the orchestrator service that a PE has crashed. In exemplaryembodiments, the PE failure event context may include a PE id, a failuredetection timestamp, and a crash reason. The orchestrator service mayalso add an epoch value to the PE failure event context, which allowsdevelopers to identify that different PE failure invocations are relatedto the same physical event. The orchestrator service may increment theepoch value based on the crash reason (e.g., host failure) and thedetection timestamp.

As discussed above, SPL allows both host placement and partitioningannotations to be specified for each operator in the streamingapplication. Users may specify these annotations based on performance,fault tolerance, and resource requirements (e.g., operators need to runin a host that has a special hardware device). A host placementconfiguration indicates in which hosts operators should reside.Influencing host placement is useful when developing management policiesthat require different applications to run in different hosts. One suchexample is a policy that manages replicas of the same application. Iftwo replicas run on the same host, a host failure results in the crashof both replicas, defeating the objective of the policy. In exemplaryembodiments, the orchestrator service may include a method that changesthe configuration of a given application to run only in exclusive hostpools, i.e., in sets of hosts that cannot be used by any otherapplication. When developers call this method, the orchestrator servicemodifies the application to update all its host pool configurations. Thehost pool configuration change must occur before the application issubmitted, since the host pool is interpreted by the SAM component wheninstantiating the PEs of the submitted application. In exemplaryembodiments, a partitioning configuration can be used to specify whichoperators should be placed in the same PE (i.e., the same operatingsystem process). One example where changing operator partitioning can beconvenient is when writing policies that involve restart of operatorsthat are logically related. If logically related groups are not isolatedinto multiple PEs, the restart of one group may force the restart ofother logically related groups, resulting in a cascading applicationrestart.

A common scenario in stream processing is to compose a solution based ona set of existing streaming applications. For example, applications canconsume streams or files produced by other applications. In exemplaryembodiments, the orchestrator is configured to allow multiple streamingapplications to be managed in the same orchestrator instance. Whencreating the orchestrator logic, developers can register explicitdependency relations between different streaming applications with theorchestrator service. Based on the dependency relations, theorchestrator service automatically submits streaming applications thatare required by other streaming applications and automatically cancelsstreaming applications that are no longer in use.

To take advantage of the automatic application submission andcancellation provided by the orchestrator, developers can createapplication configurations. An application configuration includes, butis not limited to, a string identifier, a streaming application name, astring hash map with submission-time application parameters, a Booleanindicating if the streaming application can be automatically cancelled(i.e., the application is garbage collectable), and a float valueindicating for how long a garbage collectable application shouldcontinue to run before being automatically cancelled (called the garbagecollection timeout). Once an application configuration is created foreach streaming application that must be submitted, developers canregister a unidirectional dependency between two applicationconfigurations. In exemplary embodiments, the orchestrator service isconfigured to return a registration error if the registered dependencyleads to the creation of a cycle. When registering a dependency,developers can also indicate an uptime requirement. This requirementinforms that the submission of the dependent application must be delayedby a specific number of seconds after its dependency is fulfilled (i.e.,the application it depends on is submitted).

Referring now to FIG. 6, an example application dependency graph 600 foran orchestrator managing six different streaming applications 602 inaccordance with an exemplary embodiment is shown. The annotation foreach streaming application 602 indicates the configuration parameters ofthe streaming application (T for true and F for false with respect toenabling garbage collection). The dashed arrows 604 represent theestablished unidirectional dependency between streaming applications602. The annotations on the dashed arrows 604 indicate the uptimerequirement for each dependency. Once the dependencies are established,developers can submit requests for applications to start. When the startrequest is submitted, the orchestrator service starts an applicationsubmission thread, which takes a snapshot of the current applicationdependency graph 600 and cuts all nodes and edges that are not directlyor indirectly connected to the submitted application. The orchestratorservice then searches the graph 600 for all streaming applications 602that have no dependencies (e.g., fb, tw, fox, and msnbc), and issuesstart requests to SAM for all applications that are not yet running.

The orchestrator service then searches the dependency graph 600 for thenext target application that it must instantiate and sleeps until alluptime requirements for the target application are fulfilled. Theorchestrator service chooses a streaming application 602 as the nexttarget only when all of its dependencies are satisfied and when it hasthe lowest required sleeping time among all other applications withsatisfied dependencies. For example, assuming that fb, tw, fox, andmsnbc are all submitted at the same time, the thread sleeps for 80seconds before submitting all. If sn was to be submitted in the sameround as all, sn would be submitted first because its required sleepingtime (20) is lower than all's (80). The orchestrator service delivers ajob submission event to the orchestrator logic after every applicationsubmission.

In exemplary embodiments, when an application cancellation request isissued, the orchestrator service automatically cancels unusedapplications. First, the orchestrator service evaluates the applicationdependency graph to check if the cancellation request is issued to anapplication that is feeding another running application (e.g.,cancellation request to fb). If so, the orchestrator service returns anerror code, enforcing that other applications do not starve. If not, itstarts an application cancellation thread that evaluates a full snapshotof the application dependency graph to find out which applications mustbe cancelled. Potentially, all applications that feed the cancelledapplication directly or indirectly are cancelled. An application and itsdependencies are not automatically cancelled when the application is notgarbage collectable (i.e., false is passed as a configuration toapplication fox), the application is being used by other runningapplications (e.g., fb and tw feeding an instance of sn), or theapplication was explicitly submitted by the orchestrator logic. Thethread cancels applications following the garbage collection timeouts.These timeouts are useful when the orchestrator logic submits anotherapplication that reuses an application enqueued for cancellation. Thisapplication is then immediately removed from the cancellation queue,avoiding an unnecessary application restart. For every cancelledapplication, the orchestrator service delivers a job cancellation event.

As will be appreciated by one skilled in the art, aspects of the presentdisclosure may be embodied as a system, method or computer programproduct. Accordingly, aspects of the present disclosure may take theform of an entirely hardware embodiment, an entirely software embodiment(including firmware, resident software, micro-code, etc.) or anembodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit,” “module” or “system.”Furthermore, aspects of the present disclosure may take the form of acomputer program product embodied in one or more computer readablemedium(s) having computer readable program code embodied thereon.

Any combination of one or more computer readable medium(s) may beutilized. The computer readable medium may be a computer readable signalmedium or a computer readable storage medium. A computer readablestorage medium may be, for example, but not limited to, an electronic,magnetic, optical, electromagnetic, infrared, or semiconductor system,apparatus, or device, or any suitable combination of the foregoing. Morespecific examples (a non-exhaustive list) of the computer readablestorage medium would include the following: an electrical connectionhaving one or more wires, a portable computer diskette, a hard disk, arandom access memory (RAM), a read-only memory (ROM), an erasableprogrammable read-only memory (EPROM or Flash memory), an optical fiber,a portable compact disc read-only memory (CD-ROM), an optical storagedevice, a magnetic storage device, or any suitable combination of theforegoing. In the context of this document, a computer readable storagemedium may be any tangible medium that can contain, or store a programfor use by or in connection with an instruction execution system,apparatus, or device.

A computer readable signal medium may include a propagated data signalwith computer readable program code embodied therein, for example, inbaseband or as part of a carrier wave. Such a propagated signal may takeany of a variety of forms, including, but not limited to,electro-magnetic, optical, or any suitable combination thereof. Acomputer readable signal medium may be any computer readable medium thatis not a computer readable storage medium and that can communicate,propagate, or transport a program for use by or in connection with aninstruction execution system, apparatus, or device.

Program code embodied on a computer readable medium may be transmittedusing any appropriate medium, including but not limited to wireless,wireline, optical fiber cable, RF, etc., or any suitable combination ofthe foregoing.

Computer program code for carrying out operations for aspects of thepresent disclosure may be written in any combination of one or moreprogramming languages, including an object oriented programming languagesuch as Java, Smalltalk, C++ or the like and conventional proceduralprogramming languages, such as the “C” programming language or similarprogramming languages. The program code may execute entirely on theuser's computer, partly on the user's computer, as a stand-alonesoftware package, partly on the user's computer and partly on a remotecomputer or entirely on the remote computer or server. In the latterscenario, the remote computer may be connected to the user's computerthrough any type of network, including a local area network (LAN) or awide area network (WAN), or the connection may be made to an externalcomputer (for example, through the Internet using an Internet ServiceProvider).

Aspects of the present disclosure are described below with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems) and computer program products according to embodiments of thedisclosure. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer program instructions. These computer program instructions maybe provided to a processor of a general purpose computer, specialpurpose computer, or other programmable data processing apparatus toproduce a machine, such that the instructions, which execute via theprocessor of the computer or other programmable data processingapparatus, create means for implementing the functions/acts specified inthe flowchart and/or block diagram block or blocks.

These computer program instructions may also be stored in a computerreadable medium that can direct a computer, other programmable dataprocessing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce a computerimplemented process such that the instructions which execute on thecomputer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments of the present disclosure. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof code, which comprises one or more executable instructions forimplementing the specified logical function(s). It should also be notedthat, in some alternative implementations, the functions noted in theblock may occur out of the order noted in the figures. For example, twoblocks shown in succession may, in fact, be executed substantiallyconcurrently, or the blocks may sometimes be executed in the reverseorder, depending upon the functionality involved. It will also be notedthat each block of the block diagrams and/or flowchart illustration, andcombinations of blocks in the block diagrams and/or flowchartillustration, can be implemented by special purpose hardware-basedsystems that perform the specified functions or acts, or combinations ofspecial purpose hardware and computer instructions.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the disclosure.As used herein, the singular forms “a”, “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising,” when used in this specification, specify thepresence of stated features, steps, operations, elements, and/orcomponents, but do not preclude the presence or addition of one moreother features, integers, steps, operations, element components, and/orgroups thereof.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below are intended toinclude any structure, material, or act for performing the function incombination with other claimed elements as specifically claimed. Thedescription of the present disclosure has been presented for purposes ofillustration and description, but is not intended to be exhaustive orlimited to the disclosure in the form disclosed. Many modifications andvariations will be apparent to those of ordinary skill in the artwithout departing from the scope and spirit of the disclosure. Theembodiment was chosen and described in order to best explain theprinciples of the disclosure and the practical application, and toenable others of ordinary skill in the art to understand the disclosurefor various embodiments with various modifications as are suited to theparticular use contemplated.

The flow diagrams depicted herein are just one example. There may bemany variations to this diagram or the steps (or operations) describedtherein without departing from the spirit of the disclosure. Forinstance, the steps may be performed in a differing order or steps maybe added, deleted or modified. All of these variations are considered apart of the claimed invention.

While the preferred embodiment to the disclosure had been described, itwill be understood that those skilled in the art, both now and in thefuture, may make various improvements and enhancements which fall withinthe scope of the claims which follow. These claims should be construedto maintain the proper protection for the disclosure first described.

What is claimed is:
 1. A computer program product for providing streamprocessing with runtime adaptation, the computer program productcomprising: a tangible storage device readable by a processing circuitand storing instructions for execution by the processing circuit tocreate an orchestrator configured to communicate with a runtimeinfrastructure and a stream processing application, the orchestratorconfigured to perform a method comprising: registering one or moreevents, wherein each of the events is associated with the streamprocessing application; monitoring, by a processor, for an occurrence ofthe one or more events associated with the stream processingapplication, wherein each of the one or more events is associated withone or more runtime metrics; receiving an event notification, whereinthe event notification includes event identification and an eventcontext; and based on receiving the event notification, executing anadaptation of the stream processing application, where the orchestratorincludes APIs to influence a physical deployment of the streamprocessing application by changing a placement of operators in hosts andpartitioning of operators in processing elements.
 2. The computerprogram product of claim 1, wherein the one or more events include atleast one of the one or more runtime metrics exceeding a thresholdvalue.
 3. The computer program product of claim 1, wherein the one ormore events include a system failure and one or more user-defined eventsand wherein the stream processing application comprises: a plurality ofoperators; and a plurality of processing elements, wherein each of theplurality of operators is configured to reside on one of the processingelements.
 4. The computer program product of claim 3, wherein the one ormore runtime metrics include a built-in metric and a custom metric. 5.The computer program product of claim 4, wherein the built-in metric isa counter that maintains information common to all of the plurality ofoperators and all of the plurality of processing elements.
 6. Thecomputer program product of claim 1, wherein the adaptation of thestream processing application includes changing a sampling rate of thestream processing application.
 7. The computer program product of claim1, wherein the stream processing application comprises: a plurality ofoperators; and a plurality of processing elements, wherein each of theplurality of operators is configured to reside on one of the processingelements.
 8. The computer program product of claim 7, wherein theadaptation of the stream processing application includes reassigning oneor more of the processing elements to different hosts.
 9. The computerprogram product of claim 1, wherein the event context includes runtimeinformation relating to the stream processing application.
 10. A systemfor providing stream processing with runtime adaptation, comprising: astream processing application that receives an incoming data stream; aruntime infrastructure configured to execute the stream processingapplication; and an orchestrator configured to communicate with theruntime infrastructure and the stream processing application, theorchestrator configured to perform a method comprising: receiving one ormore events, wherein each of the events is associated with the streamprocessing application; monitoring for an occurrence of the one or moreevents associated with the stream processing application, wherein eachof the one or more events is associated with one or more runtime metricsthat are associated with the runtime infrastructure; receiving an eventnotification, wherein the event notification includes eventidentification and an event context; and based on receiving the eventnotification, executing an adaptation of the stream processingapplication, where the orchestrator includes APIs to influence aphysical deployment of the stream processing application by changing aplacement of operators in hosts and partitioning of operators inprocessing elements.
 11. The system of claim 10, wherein the one or moreevents include at least one of the one or more runtime metrics exceedinga threshold value.
 12. The system of claim 10, wherein the one or moreruntime metrics include a built-in metric and a custom metric.
 13. Thesystem, of claim 12, wherein the stream processing applicationcomprises: a plurality of operators; and a plurality of processingelements, wherein each of the plurality of operators is configured toreside on one of the processing elements.
 14. The system of claim 13,wherein the adaptation of the stream processing application includesreassigning one or more of the operators to a different processingelement.
 15. The system of claim 13, wherein the built-in metric is acounter that maintains information common to all of the plurality ofoperators and all of the plurality of processing elements.
 16. Thesystem of claim 10, wherein the adaptation of the stream processingapplication includes changing a sampling rate of the stream processingapplication.
 17. The system of claim 10, wherein the event contextincludes runtime information relating to the stream processingapplication.